Skip to content

AG-81 - Enhance Command Registry with Extensible Dispatch System#91

Merged
rodneyosodo merged 4 commits into
absmach:mainfrom
JeffMboya:AG-81
Jun 18, 2026
Merged

AG-81 - Enhance Command Registry with Extensible Dispatch System#91
rodneyosodo merged 4 commits into
absmach:mainfrom
JeffMboya:AG-81

Conversation

@JeffMboya

@JeffMboya JeffMboya commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

What does this do?

Adds an extensible command registry with metadata, a help command, per-command auth, plus route, control lifecycle, and ota status commands.

Which issue(s) does this PR fix/relate to?

Resolves #81

List any changes that modify/break current functionality

None breaking. Authorization moves from a global gate to per-command; all built-ins still require a token.

Have you included tests for your changes?

Yes — registry, per-command auth, help, ota status, route validation, and all control subcommands are covered.

Did you document any new/modified functionality?

Yes — README command table and usage examples updated for help, control, ota status, and route.

Notes

New commands are MQTT-only (SenML), matching the issue format; no HTTP endpoints added.

@rodneyosodo rodneyosodo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a few minor things

Comment thread service.go
Comment thread service.go
Comment thread service.go Outdated
Enhance the command dispatch system per issue absmach#81:

- Add command metadata (name, description, usage) to the registry and a
  discoverable `help` command that reports it.
- Enforce authorization per command via a RequiresAuth flag instead of a
  single global token gate.
- Add `route` command to forward a hex payload to a downstream device
  interface and return its response.
- Extend `control` with stop/start (pause/resume heartbeat, telemetry, and
  the device scheduler), reload (re-apply persisted config overrides), and
  status, keeping the existing nodered-* passthrough.
- Add `ota,status` to query OTA state over MQTT.
- Wire Route through the logging/metrics middleware and regenerate mocks.
- Cover the registry, per-command auth, help, route, and control subcommands
  with tests; document the commands in the README.

Signed-off-by: JeffMboya <jangina.mboya@gmail.com>
- Route: resolve the device up front so a missing device returns a clear
  error instead of an opaque interface-open failure.
- controlReload: validate each persisted value before applying, skip and
  log invalid entries, and report the applied keys for auditability.
- controlStart: skip restarting the scheduler when the run context is nil
  or already cancelled, logging the reason instead of failing silently.
- Extend tests for the new reload response and validation behaviour.

Signed-off-by: JeffMboya <jangina.mboya@gmail.com>
Document the commands added in this branch now that command docs live under
docs/ rather than the README:

- control.md: extensible registry + per-command auth note, route and help in
  the subsystem table, and sections for control lifecycle (stop/start/reload/
  status), route, and help.
- ota.md: query OTA status via the commands channel (ota,status).

Signed-off-by: JeffMboya <jangina.mboya@gmail.com>
- devices.md: note the route command as a one-shot write-then-read to a
  device interface, linking to its control.md section.
- docs/README.md: update the control.md index entry to mention agent
  lifecycle, route, and help.

Signed-off-by: JeffMboya <jangina.mboya@gmail.com>
@rodneyosodo rodneyosodo merged commit b6423bd into absmach:main Jun 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance Command Registry with Extensible Dispatch System

2 participants